package com.wiloon.java8x.basic.classforname;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created with IntelliJ IDEA.
 * User: wiloon
 * Date: 12/21/13
 * Time: 9:16 PM
 * To change this template use File | Settings | File Templates.
 */

public class A

{
    private static Logger logger = LoggerFactory.getLogger(A.class.getName());

    public static void main(String[] args) throws Exception

    {

        logger.debug("" + A.class);//通过类.class获得Class对象
        A a = new A();

        logger.debug("" + a.getClass());//通过 实例名.getClass()获得Class对象

        logger.debug("" + Class.forName("A"));//通过Class.forName(全路径)获得Class对象

        logger.debug(".................................");


        logger.debug("" + a);//使用不同的方式创建对象

        logger.debug("" + A.class.newInstance());

        logger.debug("" + a.getClass().newInstance());

        logger.debug("" + Class.forName("A").newInstance());

        logger.debug("class name" + A.class.getName());
        logger.debug("object name:" + a.getClass().getName());

    }

}
